package com.ljwm.seckill.util;

import com.ljwm.seckill.dto.SeckillResult;

/**
 * Created by yuzhou on 2017/8/7.
 */
public class ResultUtil {

  public static SeckillResult success (Object data) {
    SeckillResult result = new SeckillResult();
    result.setCode(0);
    result.setData(data);
    return result;
  }

  public static SeckillResult fail (String error) {
    return fail(1, error);
  }

  public static SeckillResult fail (int code, String error) {
    SeckillResult result = new SeckillResult();
    result.setCode(code);
    result.setMsg(error);
    return result;
  }
}
